package com.luozhili.Swing;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * button 和 dialog 练习
 */
public class Demo5 extends JFrame  {
    JLabel label1;
    JButton jButton;
    JFrame frame=this;
    public Demo5() {
        Container c = this.getContentPane();

        JLabel jLabel = new JLabel("1234");
        c.add(jLabel);
        System.out.println(jLabel.getText()); //获取label内容
        jLabel.setForeground(Color.red); //字体颜色


        c.setLayout(new FlowLayout());
        this.setSize(300,150);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setVisible(true);
    }



    public static void main(String[] args) {
        new Demo5();

    }
}
